package com.sqstudio.view
{
	import com.sqstudio.common.LunarCalendar;
	import com.sqstudio.model.Model;
	import com.sqstudio.ui.TopMC;
	
	import flash.display.MovieClip;
	import flash.display.SimpleButton;
	import flash.display.Sprite;
	
	public class TopPanel extends Sprite
	{
		private var _topMc:TopMC;
		public var leftBtn:SimpleButton;
		public var rightBtn:SimpleButton;
		public var todayBtn:SimpleButton;
		public var yearBtn:MovieClip;
		public var monthBtn:MovieClip;
		
		public function TopPanel()
		{
			this._topMc = new TopMC();
			addChild(this._topMc);
			this._topMc.x = 24;
			this._topMc.y = 115;
			this._topMc.yearBtn.mouseChildren = this._topMc.monthBtn.mouseChildren = this._topMc.yearName.mouseEnabled = false;
			this._topMc.yName.mouseEnabled = this._topMc.mName.mouseEnabled = false;
			this._topMc.yearBtn.buttonMode = this._topMc.monthBtn.buttonMode = true;
			this.leftBtn = this._topMc.leftBtn;
			this.rightBtn = this._topMc.rightBtn;
			this.todayBtn = this._topMc.todayBtn;
			this.yearBtn = this._topMc.yearBtn;
			this.monthBtn = this._topMc.monthBtn;
			this._topMc.yearName.text="XX年(X年)";
		}
		/**
		 *更新年月
		 * @param $name
		 * 
		 */		
		public function updateYearMonth():void{
			var lc:LunarCalendar = new LunarCalendar(Model.CrtDate);
			var yearName:String = lc.getCnYear()+"年("+lc.getCnAnimalsSign()+"年)";
			this._topMc.yearName.text = yearName;
			this._topMc.yName.text = Model.CrtDate.getFullYear() +"年";
			this._topMc.mName.text =  Model.CrtDate.getMonth()+1 +"月";;
		}
		/**
		 *更新数字年 
		 * @param $name
		 * 
		 */		
		public function updateYear($name:String):void{
			this._topMc.yName.text = $name;
		}
		/**
		 *更新数字月 
		 * @param $name
		 * 
		 */		
		public function updateMonth($name:String):void{
			this._topMc.mName.text = $name;
		}
	}
}